package br.usp.ime.origami.solver;

import java.util.LinkedList;

import javax.swing.JFrame;

public class SolverStart {

    public static void main(String[] args) {
        if (args.length == 0) {
            System.out.println("Diga o tamanho dos pedacos");
            return;
        }
        LinkedList<Part> parts = new LinkedList<Part>();

        int A = 0;

        for (int i = 0; i < args.length; i++) {
            Part part = new Part(Integer.parseInt(args[i]));
            parts.add(part);
            A += part.getLength();
        }

        int L = (int) Math.ceil(A / 2.0);
        // calculate A
        parts.addFirst(new Part(L));
        parts.addFirst(new Part(2 * L));

        JFrame frame = new SolverFrameBuilder().build(parts, L);
        frame.setSize(800, 600);
        frame.setVisible(true);
        
    }

}
